<hr/>
<table class="table table-borderless">
  <tbody>
  <tr class="table-primary">
    <th scope="row" colspan="2">File</th>
  </tr>
  <tr>
    <th scope="row">Import Format</th>
    <td>{{importFile?.fileFormat}}</td>
  </tr>
  <tr>
    <th scope="row">Import File</th>
    <td>{{importFile?.fileName}}</td>
  </tr>
  <tr class="table-primary">
    <th scope="row" colspan="2">Summary</th>
  </tr>
  <tr>
    <th scope="row">Possible number of objects</th>
    <td>{{parsedData?.count}}</td>
  </tr>
  <tr>
    <th scope="row">Staring at object</th>
    <td>{{importerConfig?.start_element}}</td>
  </tr>
  <tr *ngIf="importerConfig?.max_elements > 0">
    <th scope="row">Max number of object</th>
    <td>{{importerConfig?.max_elements}}</td>
  </tr>
  </tbody>
</table>
<div *ngIf="!importResponse">
  <hr/>
  <button class="btn btn-success next" type="button" (click)="onStartImport()">
    Start import <i class="fas fa-save"></i>
  </button>
  <div class="clearfix"></div>
</div>
<hr/>
<div *ngIf="importResponse" id="import-response" class="row">
  <div *ngIf="importResponse.success_imports.length > 0" class="col-md-12">
    <div class="alert alert-success" role="alert">
      <h4 class="alert-heading">Import success!</h4>
      <p>Number of objects successfully imported: {{importResponse.success_imports.length}} from
        {{parsedData?.count}}</p>
      <hr/>
      <button class="btn btn-primary next" type="button" (click)="onListRedirect()">
        View list
      </button>
      <div class="clearfix"></div>
    </div>
  </div>
  <hr/>
  <div *ngIf="importResponse.failed_imports.length > 0" class="col-md-12">
    <h3>Failed Imports</h3>
    <hr/>
    <table datatable class="table table-warning">
      <thead class="thead-light">
      <tr>
        <th scope="col">Error message</th>
        <th scope="col">Object</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngFor="let failedObject of importResponse.failed_imports; let i = index">
        <td>{{failedObject?.error_message}}</td>
        <td>{{failedObject?.obj | json}}</td>
      </tr>
      </tbody>
    </table>
  </div>
</div>
